home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Amiga Plus 1999 #2
/
Amiga Plus CD - 1999 - No. 2.iso
/
System-Boost
/
Workbench
/
Archive
/
SNESDiz
/
Source
/
SnesDiz.Rexx
Wrap
OS/2 REXX Batch file
|
1998-11-08
|
4KB
|
183 lines
/*
Super Nintendo Entertainment System File Identity Description Creator
$VER: SNESDiz 1.0 by DaFoX / OmenBBS
*/
SAY ""
SAY "
[ SNESDiz 1.0 - DaFoX / OmenBBS ]
"
SAY ""
parse upper arg Afile cdiz FList
if cdiz="LIST" then do
list=1
cdiz=flist
end
if Afile="" then do
Say "RX SNESDiz.Rexx ? for Help"
Afile = exists('libs:rexxreqtools.library')
if Afile = 0
then say "You need RexxReqTools.library"
else call addlib('rexxreqtools.library',0,-30)
Afile = rtfilerequest('ram:',,"Pick a Super nintendo file:", ,,
'rt_reqpos=reqpos_centerscr')
end
else if cdiz~="COM" & cdiz~="DIZ" & cdiz~="FTP" then cdiz=""
if AFile="" | AFile="?" then do
say ""
say "Usage:"
Say " Rx SnesDizz.rexx <File>"
Say " Rx SnesDizz.rexx <File> DIZ"
Say " Rx SnesDizz.rexx <File> FTP"
Say " Rx SnesDizz.rexx <File> COM"
Say " Rx SnesDizz.rexx <FILELIST> list FTP"
Say " generate a filelist by typeing:"
say " list <DIR> Lformat %N > <Filelist>"
say ""
Say "or start it without options and select SNES file ;)"
exit
end
if cdiz="DIZ" then do
say "Creating File_Id.diz"
call open skriv,"File_Id.diz","W"
call dodiz
exit
end
else if cdiz="FTP" then do
if exists('index') then do
call rtezrequest("Append or OverWrite Index file",,
"_Append|_OverWrite","Tell me", 'rt_reqpos=reqpos_centerscr')
if rtresult == 1
then call open skriv,"index","A"
else call open skriv,"index","W"
end
else call open skriv,"index","W"
dire=0
if LIST~=1 then do
dire1=pos(":",Afile)
if dire1~=0 then dire=dire1
dire2=pos("/",Afile)
if dire2~=0 then dire=dire1
if dire~=0 & dire2~=0 then do until dire2=0
dire2=pos("/",Afile,dire)
if dire2~=0 then dire=dire2+1
end
if dire~=0 then dire=dire-1
call dodiz
exit
end
else do
if exists(AFile)==0 then do
say AFile" Does't Exists";exit
end
call open filel,AFile
filet=readln(filel)
dire1=pos(":",filet)
if dire1~=0 then dire=dire1
dire2=pos("/",filet)
if dire2~=0 then dire=dire1
if dire~=0 & dire2~=0 then do until dire2=0
dire2=pos("/",filet,dire)
if dire2~=0 then dire=dire2+1
end
if dire~=0 then dire=dire-1
call close filel
end
end
if LIST=1 then do
if exists(AFile)==0 then do
say "Wath list???";exit
end
Say "Loading from list"
call open filel,AFile
do until eof(filel)
Afile=readln(filel)
if Afile~="" then call dodiz
end
call close filel
call close skriv
end
else
call dodiz
exit
dodiz:
if exists(Afile)==0 then do
say "Can't open" Afile;return
end
call open file,Afile
x=0
pass1=""
pass2=""
diz=""
call seek(file,33216)
pas1=readch(file,21)
test1=c2x(pas1)
do a=2 to 21 by 2
if x2d(right(left(test1,a),2),2) > 90 then x=x+1
if x2d(right(left(test1,a),2),2) < 32 then x=x+1
end
if x<2 then diz=pas1
else do
y=0
call seek(file,32747)
pas2=readch(file,21)
test1=c2x(pas2)
do a=2 to 21 by 2
if x2d(right(left(test1,a),2),2) > 90 then y=y+1
if x2d(right(left(test1,a),2),2) < 32 then y=y+1
end
if y<x then diz=pas2
if y>x then diz=pas1
if pas1=pas2 then diz=pas1
if diz="" then diz="unknown"
end
big=0
diz=left(diz,1)trim(translate(right(diz,length(diz)-1), xrange('a','z'), xrange('A', 'Z')))
do a=2 to length(diz)
if big=1 then do
diz=left(diz,a-1)Upper(right(left(diz,a),1))right(diz,length(diz)-a)
end
big=0
if right(left(diz,a),1)=" " then big=1
if right(left(diz,a),1)="." then big=1
end
if cdiz="DIZ" then do
call writeln skriv,"- -[ SNES ]------------------------------- -"
call writeln skriv,"Name: "diz
call writeln skriv,"- ------------------------[ FXSNESDIZ ]--- -"
end
else if cdiz="FTP" then do
call writeln skriv,left(right(Afile,length(Afile)-dire),40) diz
end
if cdiz="COM" then address command("Filenote" '"'Afile'"' '"'diz'"')
if cdiz="" then do
say ""
Say "- -[ SNES ]------------------------------- -"
if list=1 then say "FILE: "afile
say "Name: "diz
say "- ------------------------[ FXSNESDIZ ]--- -"
end
call close file
return